package com.april.pattern.behavioral.iterator;

import java.util.ArrayList;
import java.util.List;

/**
 * @author April
 * @version V1.0.0
 * @date 2019/07/09 09:43
 * @description
 */
public class CourseAggregateImpl implements CourseAggregate{
    private List<Course> courseList;

    public CourseAggregateImpl() {
        this.courseList = new ArrayList();
    }

    @Override
    public void addCourse(Course course) {
        courseList.add(course);
    }

    @Override
    public void removeCourse(Course course) {
        courseList.remove(course);
    }

    @Override
    public CourseIterator getCourseIterator() {
        return new CourseIteratorImpl(courseList);
    }
}
